-
-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query interface #1086
Query interface #1086
Conversation
0625c7b
to
33fa85f
Compare
c9e4512
to
13a84c0
Compare
|
An official interface for asking these type of queries (that we keep stable) would greatly help people working on stuff like the VSCode plugin I think. |
I had also planned to do something similar to this. I was thinking of just creating an interface to return the TOML-parsed |
Perhaps orthogonal, this is intended for other packages to more easily hook into Its possible, but cumbersome as a human interface: A human based interface might just support active project + direct deps so that the result can be indexed by name, as opposed to UUID. |
Putting this as a reference https://doc.rust-lang.org/cargo/reference/external-tools.html#information-about-package-structure. |
One idea which might be a bit more future proof is to make a dedicated |
So in general I would love to see a stable API. In practice, for VS Code, the issue is that we want to support julia 1.0 going forward, given that it is the long term release. So anything that just appears in say in julia 1.2 or julia 1.3 doesn't help us much... In fact, what really would help us would be a package (not in the stdlib) that hides all the differences between different julia 1.x versions for us. |
I don't think anyone here really has plan on doing that. Using the "query interface" whenever it gets in a release and "ifdef" for earlier versions would likely be your best option. |
13a84c0
to
b577403
Compare
b577403
to
64b5d81
Compare
bors try |
tryBuild failed |
49f6575
to
885594a
Compare
bors try |
tryBuild succeeded |
I feel this is good to merge. Any objections/feedback? As Kristoffer suggested, the data is returned as a struct instead of a dictionary. I also added documentation and some basic tests. I also remove the old Since this is supposed to be a bit more future proof. I went with the conservative approach of requiring users to explicitly specify all the properties that they want to query. The idea is that future properties might be more a lot more expensive to compute (I'm thinking of cases where we have to parse registry info). Feedback on this approach specifically? I was also conservative with the initial set of properties that users can query. We would definitely add more properties as we understand the kinds of questions that users ask. |
| `developed` | `Bool` | Whether a package is directly tracking a directory | | ||
| `pinned` | `Bool` | Whether a package is pinned | | ||
| `source` | `String` | The directory containing the package's source code | | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which of these will be nothing
for stdlibs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All fields should "Just Work" for stdlibs, with the exception of version
which will always be nothing
.
fb7998a
to
f0cd887
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
f0cd887
to
da3d38b
Compare
I'm fairly happy with this. Unless anyone still has strong opinions, I will rebase and merge |
@@ -273,6 +270,41 @@ const develop = API.develop | |||
#TODO: Will probably be deprecated for something in PkgDev | |||
const generate = API.generate | |||
|
|||
""" | |||
Pkg.dependencies()::Dict{UUID, PackageInfo} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this include things only in the Project, or also in the Manifest or should that be an option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that you mention it, perhaps people might want to use for (uuid, pkg) in Pkg.dependencies()
? In which case a filter keyword does seem useful.
const dependencies = API.dependencies | ||
|
||
""" | ||
Pkg.project()::ProjectInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if ProjectInfo(::UUID)
would be a good constructor? Otherwise it is a bit hard to do something with the .dependencies
field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean. What would be the result of ProjectInfo(::UUID)
? What UUID would you give it?
27504e1
to
68f650f
Compare
This comment has been minimized.
This comment has been minimized.
1086: Query interface r=00vareladavid a=00vareladavid This provides a low-level interface that handles queries about the dependency graph. Co-authored-by: David Varela <[email protected]>
This comment has been minimized.
This comment has been minimized.
68f650f
to
1a09922
Compare
This comment has been minimized.
This comment has been minimized.
1086: Query interface r=00vareladavid a=00vareladavid This provides a low-level interface that handles queries about the dependency graph. Co-authored-by: David Varela <[email protected]>
This comment has been minimized.
This comment has been minimized.
1a09922
to
996c6b9
Compare
bors r+ |
1086: Query interface r=00vareladavid a=00vareladavid This provides a low-level interface that handles queries about the dependency graph. Co-authored-by: David Varela <[email protected]>
This provides a low-level interface that handles queries about the dependency graph.